#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include <OneginFunctions.h>
#include <MyFunctions.h>






int main(void)
{
    FILE *File_To_Read_From = 0;                                                                                //File to read from
    FILE *File_To_Write_To = 0;                                                                               //File to write to
    int line = 0;

    char *Buffer = (char*) calloc (1000,sizeof(Buffer));                                      //Buffer
    char **localbuf = (char**) calloc(1,sizeof(char)), **text = (char**) calloc (1000, sizeof(char));//Array of pointers

    text[0] = (char*) calloc (1, sizeof(char));                                                 //Allocating the memory
    text[0] = &Buffer[0];
    localbuf=(char*) calloc (1, sizeof(char));                                                  //used for sorting

    line = Reading_From_File(Buffer, text, File_To_Read_From, "C:/Users/Andrey/Desktop/MIPT/IT/Class/Programs/EugineOnegin/EugeneOnegin.txt");

    Sorting_The_Text(localbuf, text, line);

    Writing_to_file(text, line, File_To_Write_To, "C:/Users/Andrey/Desktop/MIPT/IT/Class/Programs/EugineOnegin/EugineOneginSorted.txt");

    printf("\n\nEverything's been sorted successfully! \a \n");
    system("PAUSE");
    printf("\nNumber of lines equals %i \a ", line);



    return 0;

}

